package servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.omg.CORBA.PRIVATE_MEMBER;

import model.MeetingRoom;
import service.MeetingRoomService;
import service.impl.MeetingRoomServiceImpl;
@WebServlet("/servlet/AddMeetingRoom")
public class AddMeetingRoom extends HttpServlet{
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// TODO 自动生成的方法存根
		
	}
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// TODO 自动生成的方法存根
		//req.setCharacterEncoding("utf-8");
		MeetingRoomService service=new MeetingRoomServiceImpl();
		//创建会议室对象room，用addMeetingRoom.jsp页面传过来的值赋值给新对象room
		MeetingRoom  room=new  MeetingRoom();
		room.setRoomnum(Integer.parseInt(req.getParameter("roomnum")));
		room.setRoomname(req.getParameter("roomname"));
		room.setCapacity(Integer.parseInt(req.getParameter("capacity")));
		room.setStatus(req.getParameter("status"));
		room.setDescription(req.getParameter("description"));
		//调用service层增加会议室的方法
		service.addMeetingRooms(room);
		
		//转向到查看会议室
		
		req.getRequestDispatcher("ViewAllMeetingRoomsServlet").forward(req, resp);
	}
}
